// JointMatchFunctionReader.cpp: implementation of the JointMatchFunctionReader class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "JointMatchFunctionReader.h"
#include "JointPortMatchFunction.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

IMPLEMENT_DYNAMIC_CREATE(JointMatchFunctionReader,PartDBReader, FunctionObject::eJOINTMATCHFUNCTION);

JointMatchFunctionReader::JointMatchFunctionReader()
{

}

JointMatchFunctionReader::~JointMatchFunctionReader()
{

}

FunctionObject* JointMatchFunctionReader::Reader(const _RecordsetPtr& rs)
{
	FunctionObject* pObject = PartDBReader::CreateObject(rs);
	ASSERT(pObject);

	ASSERT(pObject->IsKindOf(RUNTIME_CLASS_EX(JointPortMatchFunction)));
	JointPortMatchFunction* pFun = static_cast<JointPortMatchFunction*>(pObject);

	CString strTemp;
	strTemp = GetString(1, rs);

	INT nNum = atoi(strTemp);

	for(int i = 0; i < nNum; i++)
	{
		strTemp = GetString(i+2, rs);
		pFun->Add(strTemp);
	}

	return pFun;
}